{% extends "head-footer.html" %}
{% load staticfiles %}


{% block middle %}

    <aside class="main-sidebar">

        <!-- sidebar: style can be found in sidebar.less -->
        <section class="sidebar">
            <!-- search form (Optional) -->
            <form action="#" method="get" class="sidebar-form">
                <div class="input-group">
                    <input type="text" name="q" class="form-control" placeholder="Search...">
                    <span class="input-group-btn">
                <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
                </button>
              </span>
                </div>
            </form>
      <!-- /.search form -->

      <!-- Sidebar Menu -->
         <ul class="sidebar-menu">
                <li class="header"></li>
        <!-- Optionally, you can add icons to the links -->
             {% for menu in request.reveal_menu %}
                 {% if not menu.url %}
{#                     如果菜单 没有URL,则这个二级菜单是一个菜单组，样式设置为Treeview#}
                    <li class="treeview" id="{{ menu.code }}">
                      <a href="#"><i class="{{ menu.icon }}"></i> <span>{{ menu.name }}</span>
                        <span class="pull-right-container">
                          <i class="fa fa-angle-left pull-right"></i>
                        </span>
                      </a>
                      <ul class="treeview-menu">
                          {% for sub in menu.sub_menu %}
                        <li><a href="{{ sub.url }}"><i class="fa fa-caret-right"></i>{{ sub.name }}</a></li>
                          {% endfor %}
                      </ul>
                    </li>

                 {% else %}
                 {#                     如果菜单有URL,则这是一个功能菜单，直接作为导航菜单，不再添加折叠样式#}
                     <li id="{{ menu.code }}">
                        <a href="{{ menu.url }}"><i class="{{ menu.code }}"></i><span>{{ menu.name }}</span></a>
                     </li>

                 {% endif %}

             {% endfor %}
          </ul>
      <!-- /.sidebar-menu -->
    </section>
    <!-- /.sidebar -->
  </aside>


<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <section class="content-header margin-bottom">
        <ol class="breadcrumb">
            {% if menu.parent %}
                <li class="active">
                    <a href="{{ menu.parent.url|default:'' }}">{{ menu.parent.name }}</a>
                </li>
            {% endif %}
                <li class="active">
                    <a href="{{ menu.url }}">{{ menu.name }}</a>
                </li>
        </ol>
    </section>
  {% block content %}


  {% endblock %}

</div>
<!-- /.content-wrapper -->

{% endblock %}
